
<?php 
include("header.php"); 
$id_selected= (isset($_POST['selectedid'])? $_POST['selectedid'] :$_GET['id']);

?>
<script type="text/javascript">
function openChild(value_to_pass){
	window.showModalDialog("addphoto.php",value_to_pass,"dialogWidth:490px;dialogHeight:300px;center:yes;help:no;resizable:no;status:no");
	window.location = <?php echo "\"allphoto.php?id=".$id_selected."\""?>;
} 
</script>

<!--  start page-heading -->
<div id="page-heading">
<h1>Edit Photo</h1>
</div>
<!-- end page-heading -->

<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top">&nbsp;</td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td>
<!--  start content-table-inner ...................................................................... START -->
<div id="content-table-inner">

<!--  start table-content  -->
<div id="table-content">
<?php
if(isset($_GET['succ']) && $_GET['succ']==1){
$msg = "deleted ";
?>
<div id="message-green">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="green-left">Image <?=$msg?> sucessfully.</td>
					<td class="green-right"><a class="close-green"><img src="images/table/icon_close_green.gif"   alt="" /></a></td>
				</tr>
				</table>
</div>
<?php
};
?>
<!--  start product-table ..................................................................................... -->
<form id="mainform" action="">

<input type="button" id="uploadbt" style="background:url('images/forms/choose-file.gif'); width:90px; height:30px; background-repeat:no-repeat; border: none;" <?php echo "onclick=openChild(\"".$id_selected."\")";?>  />

<?php

// Connect to server and select databse.
mysql_connect(DBADDR, DBUSER, DBPWD)or die("cannot connect");
mysql_select_db(DBNAME)or die("cannot select DB");
mysql_query('set names utf8'); 

$sql = "SELECT `RESTO_ID`, `PIC_LOCATION`, `INTRO_FR`, `INTRO_ARB` FROM `resto_pic` WHERE `RESTO_ID` = ".$id_selected;
$rs_result = mysql_query ($sql);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$rs_result) {
	$message  = 'Invalid query: ' . mysql_error() . "\n";
	$message .= 'Whole query: ' . $sql;
	die($message);
}
?> 
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
<tr>
<th class="table-header-repeat line-left minwidth-1"><a href="">Pic</a></th>
<th class="table-header-repeat line-left minwidth-1"><a href="">Descriptions</a></th>
<th class="table-header-options line-left"><a href="">Options</a></th>
</tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) { 
	?>
	<tr>
	<td><img height="200" width="230" <?php echo "src=\"../".$row['PIC_LOCATION']."\""; ?>/></td>
	<td>
	<table style="border:none;" width="100%" cellpadding="0" cellspacing="0" class="">
	<tr><td style="border:none;"><?php echo $row['INTRO_FR']; ?></td></tr>
	<tr></tr>
	<tr><td style="border:none;"><?php echo $row['INTRO_ARB']; ?></td></tr>
	</table>
	</td>

	<td class="options-width">
	<a href="javascript:void(0);" <?php echo "onclick=\"submit_form('deletepic.php',  '".$row['PIC_LOCATION']."')\""?> title="Delete" class="icon-2 info-tooltip"></a>
	</td>
	</tr>
	<?php
};
?> 
</table>
<!--  end product-table................................... --> 
</form>
</div>
<!--  end content-table  -->


<!--  start paging..................................................... -->

<!--  end paging................ -->

<div class="clear"></div>

</div>
<!--  end content-table-inner ............................................END  -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom">&nbsp;</td>
<th class="sized bottomright"></th>
</tr>
</table>
<div class="clear">&nbsp;</div>

</div>
<!--  end content -->
<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>

<!-- start footer -->         
<div id="footer">
<!--  start footer-left -->
<div id="footer-left">

Admin Skin &copy; Copyright Internet Dreams Ltd. <span id="spanYear"></span> <a href="">www.netdreams.co.uk</a>. All rights reserved.</div>
<!--  end footer-left -->
<div class="clear">&nbsp;</div>
</div>
<!-- end footer -->

</body>
</html>
